const router = require('koa-router')()
router.prefix('/goods')

const { find, create, sort, region, paging, comprehensive } = require('../controllers/goods')

// 获取商品列表 http://localhost:3000/
router.get('/', find);

// 创建商品
router.post('/', create)

// 商品排序 http://localhost:3000/sort?sort=-1
router.get('/sort', sort);

// 分页 http://localhost:3000/paging?page=1
router.get('/paging',paging)

// 商品区间过滤
router.get('/region', region)

// 综合以上接口
/*
排序和分页 http://localhost:3000/comprehensive?sort=1&page=2&pageSize=5
商品区间过滤 http://localhost:3000/comprehensive?sort=1&page=1&pageSize=5&priceLeval=0
*/
router.get('/comprehensive', comprehensive)

module.exports = router